﻿using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SEPD.CAD.Template.Palette
{
    public partial class TemplatePaletteSetViewModel : BindableBase
    {

        private void PreProccess()
        {
            //assemblyDir = Path.GetDirectoryName(assemblyPath) + "\\";
            return;
        }


        private void TempExecute1()
        {
            DebugMessage = "btn1 clicked";
        }

        private void TempExecute2()
        {
            //
            TempFunction2(); 
        }

        /// <summary>
        /// 在工程界面生成文字
        /// </summary>
        private void TempExecute3()
        {
            CommonVoidDelegate voidDelegate = new CommonVoidDelegate(CadDbText);
            CommonVoidExecutor(voidDelegate);
        }

        /// <summary>
        /// 选择实体 显示在界面表格中
        /// </summary>
        private void TempExecute4()
        {
            var entitys = SelectEntity().ToList();
            List<TemplateModel> templateModels = new List<TemplateModel>();
            foreach (var entity in entitys)
            {
                TemplateModel templateModel = new TemplateModel();
                templateModel.id = entity.Id.ToString();
                templateModel.name = entity.BlockName.ToString();
                templateModel.code = entity.BlockId.ToString();
                templateModels.Add(templateModel);
            }
            ObservableCollection<TemplateModel> temps = new ObservableCollection<TemplateModel>();
            templateModels.ForEach(m => temps.Add(m));
            TemplateModels = temps;

        }


    }
}
